home *** CD-ROM | disk | FTP | other *** search
/ Revista do CD-ROM 101 / CD-ROM 101.iso / compl / maya5ple / Install_MayaPLE5_English.exe / Maya / Data1.cab / performFlare.mel < prev    next >
Encoding:
Text File  |  2003-07-17  |  21.4 KB  |  791 lines

  1. // Copyright (C) 1997-2002 Alias|Wavefront,
  2. // a division of Silicon Graphics Limited.
  3. //
  4. // The information in this file is provided for the exclusive use of the
  5. // licensees of Alias|Wavefront.  Such users have the right to use, modify,
  6. // and incorporate this code into other products for purposes authorized
  7. // by the Alias|Wavefront license agreement, without fee.
  8. //
  9. // ALIAS|WAVEFRONT DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  10. // INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
  11. // EVENT SHALL ALIAS|WAVEFRONT BE LIABLE FOR ANY SPECIAL, INDIRECT OR
  12. // CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE,
  13. // DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER
  14. // TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
  15. // PERFORMANCE OF THIS SOFTWARE.
  16. //
  17. //
  18. //  Alias|Wavefront Script File
  19. //  MODIFY THIS AT YOUR OWN RISK
  20. //
  21. //  Creation Date:  18 April 1997
  22. //
  23. //  Description:
  24. //      flare default options box.  The content for each tab 
  25. //        is not created until it is accessed for the first time.
  26. //
  27. //////////////////////////////////////////////////////////////////////
  28. //
  29. //  Procedure Name:
  30. //      setOptionVars
  31. //
  32. //  Description:
  33. //        Initialize the option values.
  34. //
  35. //  Input Arguments:
  36. //        Whether to set the options to default values.
  37. //
  38. //  Return Value:
  39. //      None.
  40. //
  41. proc setOptionVars(int $forceFactorySettings)
  42. {
  43.     //    min.
  44.     //
  45.     if ($forceFactorySettings || !`optionVar -exists flareMin`) {
  46.         optionVar -floatValue  flareMin -1.0;
  47.     }
  48.  
  49.     //    max.
  50.     //
  51.     if ($forceFactorySettings || !`optionVar -exists flareMax`) {
  52.         optionVar -floatValue  flareMax 1.0;
  53.     }
  54.  
  55.     //    start flareX.
  56.     //
  57.     if ($forceFactorySettings || !`optionVar -exists flareStartFlareX`) {
  58.         optionVar -floatValue  flareStartFlareX 1.0;
  59.     }
  60.  
  61.     //    start flareZ.
  62.     //
  63.     if ($forceFactorySettings || !`optionVar -exists flareStartFlareZ`) {
  64.         optionVar -floatValue  flareStartFlareZ 1.0;
  65.     }
  66.  
  67.     //    end flareX.
  68.     //
  69.     if ($forceFactorySettings || !`optionVar -exists flareEndFlareX`) {
  70.         optionVar -floatValue  flareEndFlareX 1.0;
  71.     }
  72.  
  73.     //    end flareZ.
  74.     //
  75.     if ($forceFactorySettings || !`optionVar -exists flareEndFlareZ`) {
  76.         optionVar -floatValue  flareEndFlareZ 1.0;
  77.     }
  78.  
  79.     //    curve.
  80.     //
  81.     if ($forceFactorySettings || !`optionVar -exists flareCurve`) {
  82.         optionVar -floatValue  flareCurve 0.0;
  83.     }
  84.  
  85.     // default options common to all deformers
  86.     //
  87.     if ($forceFactorySettings || !`optionVar -exists flarePositioning`) {
  88.         optionVar -stringValue flarePositioning "default";
  89.     }
  90.     if ($forceFactorySettings || !`optionVar -exists flareExclusive`) {
  91.         // 0 == no exclusive
  92.         // 1 == exclusive with new name
  93.         // 2 == exclusive using an existing partition
  94.         //
  95.         optionVar -intValue flareExclusive 0;
  96.     }
  97.     if ($forceFactorySettings || !`optionVar -exists flareExclName`) {
  98.         optionVar -stringValue flareExclName "deformPartition";
  99.     }
  100. }
  101.  
  102. //
  103. //  Procedure Name:
  104. //      flareSetup
  105. //
  106. //  Description:
  107. //        Update the state of the option box UI to reflect the option values.
  108. //
  109. //  Input Arguments:
  110. //      parent               - Top level parent layout of the option box UI.
  111. //                             Required so that UI object names can be 
  112. //                             successfully resolved.
  113. //
  114. //        forceFactorySettings - Whether the option values should be set to
  115. //                             default values.
  116. //
  117. //      tabIndex             - 0 = both tabs, 1 = basic, 2 = advanced
  118. //
  119. //  Return Value:
  120. //      None.
  121. //
  122. global proc flareSetup(string $parent,
  123.                        int $forceFactorySettings,
  124.                        int $tabIndex)    
  125. {
  126.     //    Retrieve the option settings
  127.     //
  128.     setOptionVars($forceFactorySettings);
  129.     setParent $parent;
  130.  
  131.     //    Query the optionVar's and set the values into the controls.
  132.     //
  133.     if ($tabIndex != 2) {    
  134.         //    min.
  135.         //
  136.         if (`floatSliderGrp -exists flareMin`) {
  137.             floatSliderGrp -edit 
  138.                 -value `optionVar -query flareMin`
  139.                 flareMin;
  140.         }
  141.         
  142.         //    max.
  143.         //
  144.         if (`floatSliderGrp -exists flareMax`) {
  145.             floatSliderGrp -edit 
  146.                 -value `optionVar -query flareMax`
  147.                 flareMax;
  148.         }
  149.         
  150.         //    start flareX.
  151.         //
  152.         if (`floatSliderGrp -exists flareStartFlareX`) {
  153.             floatSliderGrp -edit 
  154.                 -value `optionVar -query flareStartFlareX`
  155.                 flareStartFlareX;
  156.         }
  157.         
  158.         //    start flareZ.
  159.         //
  160.         if (`floatSliderGrp -exists flareStartFlareZ`) {
  161.             floatSliderGrp -edit 
  162.                 -value `optionVar -query flareStartFlareZ`
  163.                 flareStartFlareZ;
  164.         }
  165.         
  166.         //    end flareX.
  167.         //
  168.         if (`floatSliderGrp -exists flareEndFlareX`) {
  169.             floatSliderGrp -edit 
  170.                 -value `optionVar -query flareEndFlareX`
  171.                 flareEndFlareX;
  172.         }
  173.         
  174.         //    end flareZ.
  175.         //
  176.         if (`floatSliderGrp -exists flareEndFlareZ`) {
  177.             floatSliderGrp -edit 
  178.                 -value `optionVar -query flareEndFlareZ`
  179.                 flareEndFlareZ;
  180.         }
  181.         
  182.         //    curve.
  183.         //
  184.         if (`floatSliderGrp -exists flareCurve`) {
  185.             floatSliderGrp -edit 
  186.                 -value `optionVar -query flareCurve`
  187.                 flareCurve;
  188.         }
  189.     }
  190.  
  191.     if ($tabIndex != 1) {
  192.         // Positioning of the flare deformer in the DG
  193.         //
  194.         string $positioning = `optionVar -query flarePositioning`;
  195.         if (`optionMenuGrp -exists flarePositioningWidget`) {
  196.             if ($positioning == "default") {
  197.                 optionMenuGrp -edit -select 1 flarePositioningWidget;
  198.             }
  199.             else if ($positioning == "before") {
  200.                 optionMenuGrp -edit -select 2 flarePositioningWidget;
  201.             }
  202.             else if ($positioning == "after") {
  203.                 optionMenuGrp -edit -select 3 flarePositioningWidget;
  204.             }
  205.             else if ($positioning == "split") {
  206.                 optionMenuGrp -edit -select 4 flarePositioningWidget;
  207.             }
  208.             else if ($positioning == "parallel") {
  209.                 optionMenuGrp -edit -select 5 flarePositioningWidget;
  210.             }
  211.             else {
  212.                 optionMenuGrp -edit -select 1 flarePositioningWidget;
  213.             }
  214.         }
  215.         
  216.         int $exc=`optionVar -query flareExclusive`;
  217.         if (`checkBoxGrp -exists exclWidget`) {
  218.             checkBoxGrp -e -v1 $exc exclWidget;
  219.         }
  220.         string $exn=`optionVar -query flareExclName`;
  221.         if (`textFieldGrp -exists partitionNameWidget`) {
  222.             textFieldGrp -e -tx $exn -enable $exc partitionNameWidget;
  223.         }
  224.         if (`optionMenuGrp -exists partitionListWidget`) {
  225.             optionMenuGrp -e  -enable $exc partitionListWidget;
  226.         }
  227.     }
  228. }
  229.  
  230. //
  231. //  Procedure Name:
  232. //      flareCallback
  233. //
  234. //  Description:
  235. //        Update the option values with the current state of the option box UI.
  236. //
  237. //  Input Arguments:
  238. //      parent - Top level parent layout of the option box UI.  Required so
  239. //               that UI object names can be successfully resolved.
  240. //
  241. //        doIt   - Whether the command should execute.
  242. //
  243. //  Return Value:
  244. //      None.
  245. //
  246. global proc flareCallback(string $parent, int $doIt)
  247. {
  248.     //    Set the optionVar's from the control values, and then
  249.     //    perform the command.
  250.  
  251.     //    Min.
  252.     //
  253.     if (`floatSliderGrp -exists flareMin`) {
  254.         optionVar -floatValue flareMin        
  255.             `floatSliderGrp -query -value flareMin`;
  256.     }
  257.  
  258.     //    Max.
  259.     //
  260.     if (`floatSliderGrp -exists flareMax`) {
  261.         optionVar -floatValue flareMax        
  262.             `floatSliderGrp -query -value flareMax`;
  263.     }
  264.  
  265.     //    start FlareX.
  266.     //
  267.     if (`floatSliderGrp -exists flareStartFlareX`) {
  268.         optionVar -floatValue flareStartFlareX        
  269.             `floatSliderGrp -query -value flareStartFlareX`;
  270.     }
  271.  
  272.     //    start FlareZ.
  273.     //
  274.     if (`floatSliderGrp -exists flareStartFlareZ`) {
  275.         optionVar -floatValue flareStartFlareZ        
  276.             `floatSliderGrp -query -value flareStartFlareZ`;
  277.     }
  278.  
  279.     //    end FlareX.
  280.     //
  281.     if (`floatSliderGrp -exists flareEndFlareX`) {
  282.         optionVar -floatValue flareEndFlareX        
  283.             `floatSliderGrp -query -value flareEndFlareX`;
  284.     }
  285.  
  286.     //    end FlareZ.
  287.     //
  288.     if (`floatSliderGrp -exists flareEndFlareZ`) {
  289.         optionVar -floatValue flareEndFlareZ        
  290.             `floatSliderGrp -query -value flareEndFlareZ`;
  291.     }
  292.  
  293.     //    Curve.
  294.     //
  295.     if (`floatSliderGrp -exists flareCurve`) {
  296.         optionVar -floatValue flareCurve        
  297.             `floatSliderGrp -query -value flareCurve`;
  298.     }
  299.  
  300.     // Positioning of the flare deformer in the DG
  301.     //
  302.     string $positioning = "default";
  303.     if (`optionMenuGrp -exists flarePositioningWidget`) {
  304.         if (`optionMenuGrp -query -select flarePositioningWidget` == 1) {
  305.             $positioning = "default";
  306.         }
  307.         else if (`optionMenuGrp -query -select flarePositioningWidget` == 2){
  308.             $positioning = "before";
  309.         }
  310.         else if (`optionMenuGrp -query -select flarePositioningWidget` == 3){
  311.             $positioning = "after";
  312.         }
  313.         else if (`optionMenuGrp -query -select flarePositioningWidget` == 4){
  314.             $positioning = "split";
  315.         }
  316.         else if (`optionMenuGrp -query -select flarePositioningWidget` == 5){
  317.             $positioning = "parallel";
  318.         }
  319.     }
  320.     optionVar -stringValue flarePositioning $positioning;
  321.  
  322.     if (`checkBoxGrp -exists exclWidget`) {
  323.         optionVar -intValue flareExclusive `checkBoxGrp -q -v1 exclWidget`;
  324.     }
  325.     if (`optionMenuGrp -exists partitionListWidget`) {
  326.         string $partitionNameVal = `optionMenuGrp -q -v partitionListWidget`;
  327.         if ($partitionNameVal == "Create New Partition") {
  328.             if (`textFieldGrp -exists partitionNameWidget`) {
  329.                 $partitionNameVal = `textFieldGrp -q -tx partitionNameWidget`;
  330.             }
  331.         } else {
  332.             // a value of 2 indicates that we use an existing partition
  333.             //
  334.             optionVar -intValue flareExclusive 2;
  335.         }
  336.         
  337.         optionVar -stringValue flareExclName $partitionNameVal;
  338.     }
  339.     
  340.     if ($doIt) {
  341.         performFlare 0; 
  342.         addToRecentCommandQueue "performFlare 0" "Flare";
  343.     }
  344. }
  345.  
  346.  
  347. //
  348. //  Procedure Name:
  349. //      createFlareTabUI
  350. //
  351. //  Description:
  352. //        Create the tab UI.  The contents of each tab are created only 
  353. //        when it is required, ie. if the tab is initially visible or 
  354. //        if the tab is selected by the user.
  355. //
  356. //  Input Arguments:
  357. //      The name of the tab layout.
  358. //
  359. //  Return Value:
  360. //      None.
  361. //
  362. global proc createFlareTabUI(string $tabLayout)
  363. {
  364.     string $tab[] = `tabLayout -query -childArray $tabLayout`;
  365.     int $currentTabIndex = `tabLayout -query -selectTabIndex $tabLayout`;
  366.  
  367.     //    Determine if the UI for this tab has been created yet.
  368.     //    This is accomplished by querying the number of children
  369.     //    in the current tab.  If the tab has no children then the UI
  370.     //    must be created.
  371.     //
  372.     if (0 == `columnLayout -query -numberOfChildren $tab[$currentTabIndex-1]`) {
  373.  
  374.         setParent $tab[$currentTabIndex-1];
  375.  
  376.         string $label;
  377.         int $index;
  378.  
  379.         //    Activate the default UI template so that the layout of this 
  380.         //    option box is consistent with the layout of the rest of the 
  381.         //    application.
  382.         //
  383.         setUITemplate -pushTemplate DefaultTemplate;
  384.  
  385.         //    Turn on the wait cursor.
  386.         //
  387.         waitCursor -state 1;
  388.  
  389.         //    The current tab has no children.  Determine which tab is
  390.         //    active and create its UI.
  391.         //
  392.         //    RECOMMENDATION:  Use the 'Grp' commands where possible because
  393.         //    they obey the formatting specified in the default template.
  394.         //    This will result in a more consistent look throughout the
  395.         //    application.
  396.         //    
  397.         if (1 == $currentTabIndex) {
  398.  
  399.             //    Create UI for the first tab.
  400.             //
  401.             floatSliderGrp -label "Low Bound" -fieldMinValue -10000.0 
  402.               -minValue -10.0 -maxValue 0.0 flareMin;
  403.  
  404.             floatSliderGrp -label "High Bound" -minValue 0.0 
  405.               -maxValue 10.0 -fieldMaxValue 10000.0 flareMax;
  406.  
  407.             floatSliderGrp -label "Start FlareX" -minValue 0.0 -maxValue 10.0
  408.                 -fieldMinValue -10000.0 -fieldMaxValue 10000.0
  409.                 flareStartFlareX;
  410.  
  411.             floatSliderGrp -label "Start FlareZ" -minValue 0.0 -maxValue 10.0
  412.                 -fieldMinValue -10000.0 -fieldMaxValue 10000.0
  413.                 flareStartFlareZ;
  414.  
  415.             floatSliderGrp -label "End FlareX" -minValue 0.0 -maxValue 10.0
  416.                 -fieldMinValue -10000.0 -fieldMaxValue 10000.0
  417.                 flareEndFlareX;
  418.  
  419.             floatSliderGrp -label "End FlareZ" -minValue 0.0 -maxValue 10.0
  420.                 -fieldMinValue -10000.0 -fieldMaxValue 10000.0
  421.                 flareEndFlareZ;
  422.  
  423.             floatSliderGrp -label "Curve" -minValue -10.0 -maxValue 10.0
  424.                 -fieldMinValue -10000.0 -fieldMaxValue 10000.0
  425.                 flareCurve;
  426.  
  427.             setParent ..;
  428.         } else if (2 == $currentTabIndex) {
  429.             
  430.             //    Create UI for the second tab.
  431.             //
  432.             columnLayout -adjustableColumn true;
  433.  
  434.             // Positioning of the flare deformer in the DG
  435.             optionMenuGrp -label "Deformation Order" flarePositioningWidget;
  436.             menuItem -label "Default"       flarePosItem1;
  437.             menuItem -label "Before"        flarePosItem2;
  438.             menuItem -label "After"         flarePosItem3;
  439.             menuItem -label "Split"         flarePosItem4;
  440.             menuItem -label "Parallel"      flarePosItem5;
  441.  
  442.             separator;
  443.             checkBoxGrp    
  444.                 -numberOfCheckBoxes 1
  445.                 -label ""
  446.                 -label1 "Exclusive"
  447.                 -v1 0 
  448.                 -on1 "optionMenuGrp -e -enable 1 partitionListWidget; updatePartitionNameWidget;"
  449.                 -offCommand "optionMenuGrp -e -enable 0 partitionListWidget; updatePartitionNameWidget;"
  450.                 exclWidget;
  451.  
  452.             // Create an option menu listing the partitions
  453.             //
  454.             optionMenuGrp -l "Partition to Use" -enable `checkBoxGrp -q -v1 exclWidget`
  455.                 -cc "updatePartitionNameWidget" partitionListWidget;
  456.  
  457.             string $currentNameOption = "";
  458.             if (`optionVar -exists flareExclName`) {
  459.                 $currentNameOption = `optionVar -q flareExclName`;
  460.             }
  461.             
  462.             // add all the partitions to the menu
  463.             //
  464.             int $pp;
  465.             string $partitionArray[];
  466.             $partitionArray = `ls -type partition`;
  467.             int $partitionCount = size($partitionArray);
  468.             menuItem -l "Create New Partition";
  469.             for ($pp = 0; $pp < $partitionCount; $pp++)
  470.             {
  471.                 // Do not list the render partition as adding items to
  472.                 // it is only going to cause confusion.
  473.                 //
  474.                 if ($partitionArray[$pp] != "renderPartition" && 
  475.                     $partitionArray[$pp] != "characterPartition") {
  476.                     menuItem -l $partitionArray[$pp];
  477.                 }
  478.                 if ($currentNameOption == $partitionArray[$pp]) {
  479.                     optionVar -stringValue flareExclName "deformPartition";
  480.                 }
  481.             }
  482.  
  483.             textFieldGrp -l "New Partition Name" -enable `checkBoxGrp -q -v1 exclWidget` 
  484.                 -tx "deformPartition"
  485.                 partitionNameWidget;
  486.         
  487.             updatePartitionNameWidget;
  488.         }
  489.  
  490.         //    Update the control values to match the options.
  491.         //
  492.         eval (("flareSetup " + $tabLayout + " "+0+" "+$currentTabIndex));
  493.     
  494.         //    Turn off the wait cursor.
  495.         //
  496.         waitCursor -state 0;
  497.         
  498.         //    Deactivate the default UI template.
  499.         //
  500.         setUITemplate -popTemplate;
  501.     }
  502. }
  503.  
  504. //
  505. //  Procedure Name:
  506. //      flareOptions
  507. //
  508. //  Description:
  509. //        Construct the option box UI.  Involves accessing the standard option
  510. //        box and customizing the UI accordingly.
  511. //
  512. //  Input Arguments:
  513. //      None.
  514. //
  515. //  Return Value:
  516. //      None.
  517. //
  518. // ********* Change 'flare' in this proc to be the name of your command
  519. proc flareOptions()
  520. {
  521.     //    Name of the command for this option box.
  522.     //
  523.     string $commandName = "nonLinear";
  524.  
  525.     //    Build the option box actions.
  526.     //
  527.     string $callback = ("flareCallback");
  528.     string $setup = ("flareSetup");
  529.  
  530.     //    STEP 1:  Get the option box.
  531.     //    ============================
  532.     //
  533.     //  The value returned is the name of the layout to be used as
  534.     //    the parent for the option box UI.
  535.     //
  536.     string $layout = getOptionBox();
  537.     setParent $layout;
  538.     
  539.     //    STEP 2:  Pass the command name to the option box.
  540.     //    =================================================
  541.     //
  542.     //    Any default option box behaviour based on the command name is set 
  543.     //    up with this call.  For example, updating the 'Help' menu item with
  544.     //    the name of the command.
  545.     //
  546.     setOptionBoxCommandName($commandName);
  547.  
  548.     //    STEP 3:  Activate the default UI template.
  549.     //    ==========================================
  550.     //
  551.     //    Activate the default UI template so that the layout of this 
  552.     //    option box is consistent with the layout of the rest of the 
  553.     //    application.
  554.     //
  555.     //    Note: this option box example delays the creation of the UI
  556.     //    until it's required.  Therefore this step is moved to the
  557.     //    procedure where the UI is actually created. 
  558.     //
  559.     //setUITemplate -pushTemplate DefaultTemplate;
  560.  
  561.     //    STEP 4: Create option box contents.
  562.     //    ===================================
  563.     //    
  564.     //    This, of course, will vary from option box to option box.    
  565.     
  566.     //    Demonstrate the delaying of UI creation via tab layouts.
  567.     //    Instead of creating all of the option box UI initially, only
  568.     //    create that which is initially visible.  Wait, until the 
  569.     //    other tabs are selected to create the remaining UI.
  570.     //
  571.     string $tabLayout = `tabLayout -scrollable 1`;
  572.  
  573.     //    Attach an action that will be invoked before a tab is selected.
  574.     //    
  575.     tabLayout -edit 
  576.         -preSelectCommand ("createFlareTabUI " + $tabLayout)
  577.         $tabLayout;
  578.  
  579.     //    Create just the immediate children of the tab layout so that
  580.     //    the tabs appear.
  581.     //
  582.     columnLayout;
  583.         setParent ..;
  584.     columnLayout;
  585.         setParent ..;
  586.     
  587.     //    Set the tab labels.
  588.     //
  589.     tabLayout -edit
  590.         -tabLabelIndex 1 "Basic"
  591.         -tabLabelIndex 2 "Advanced"
  592.         $tabLayout;
  593.  
  594.     //    Create the UI for the tab that is initially visible.
  595.     //
  596.     createFlareTabUI($tabLayout);
  597.  
  598.     //    Step 5: Deactivate the default UI template.
  599.     //  ===========================================
  600.     //
  601.     //    Note: this option box example delays the creation of the UI
  602.     //    until it's required.  Therefore this step is moved to the
  603.     //    procedure where the UI is actually created.
  604.     //
  605.     //    See also Step 2. 
  606.     //
  607.     //setUITemplate -popTemplate;
  608.  
  609.     //    Step 6: Customize the buttons.  
  610.     //    ==============================
  611.     //
  612.     //    Provide more descriptive labels for the buttons.  This is not 
  613.     //    necessary, but in some cases, for example, a button labelled 
  614.     //    'Create' may be more meaningful to the user than one labelled
  615.     //    'Apply'.
  616.     //
  617.     //  Disable those buttons that are not applicable to the option box.
  618.     //
  619.     //    Attach actions to those buttons that are applicable to the option
  620.     //    box.  Note that the 'Close' button has a default action attached 
  621.     //    to it that will hide the window.  If a a custom action is
  622.     //    attached to the 'Close' button then be sure to call the 'hide the
  623.     //    option box' procedure within the custom action so that the option
  624.     //    box is hidden properly.
  625.  
  626.     //    'Apply' button.
  627.     //
  628.     string $applyBtn = getOptionBoxApplyBtn();
  629.     button -edit
  630.         -label "Create"
  631.         -command ($callback + " " + $tabLayout + " " + 1)
  632.         $applyBtn;
  633.  
  634.     //    'Save' button.
  635.     //
  636.     string $saveBtn = getOptionBoxSaveBtn();
  637.     button -edit 
  638.         -command ($callback + " " + $tabLayout + " " + 0 + "; hideOptionBox")
  639.         $saveBtn;
  640.  
  641.     //    'Reset' button.
  642.     //
  643.     string $resetBtn = getOptionBoxResetBtn();
  644.     button -edit 
  645.         -command ($setup + " " + $tabLayout + " " + 1 + " " + 0)
  646.         $resetBtn;
  647.  
  648.     //    Step 7: Set the option box title.
  649.     //    =================================
  650.     //
  651.     setOptionBoxTitle("Create Flare Deformer Options");
  652.  
  653.     //    Step 8: Customize the 'Help' menu item text.
  654.     //    ============================================
  655.     //
  656.     setOptionBoxHelpTag( "Flare" );
  657.  
  658.     //    Step 9: Set the current values of the option box.
  659.     //    =================================================
  660.     //
  661.     //    NOTE:  Can not do this here since we do not know what UI is
  662.     //    currently visible.  This is moved to where the UI is created.
  663.     //
  664.     //eval (($setup + " " + $tabLayout + " " + 0));    
  665.     
  666.     //    Step 10: Show the option box.
  667.     //    =============================
  668.     //
  669.     showOptionBox();
  670. }
  671.  
  672. //
  673. //  Procedure Name:
  674. //      optionBoxExample1Help
  675. //
  676. //  Description:
  677. //        Return a short description about this command.
  678. //
  679. //  Input Arguments:
  680. //      None.
  681. //
  682. //  Return Value:
  683. //      string.
  684. //
  685. proc string flareHelp()
  686. {
  687.     return 
  688.     "  Command: flare - creates a flare\n" +
  689.     "Selection: Deformable geometry.";    
  690. }
  691.  
  692. proc string getCmd()
  693. {
  694.     string $cmd = "nonLinear -type flare ";
  695.  
  696.     $cmd += " -lowBound " + `optionVar -query flareMin`;
  697.     $cmd += " -highBound " + `optionVar -query flareMax`;
  698.     $cmd += " -startFlareX " + `optionVar -query flareStartFlareX`;
  699.     $cmd += " -startFlareZ " + `optionVar -query flareStartFlareZ`;
  700.     $cmd += " -endFlareX " + `optionVar -query flareEndFlareX`;
  701.     $cmd += " -endFlareZ " + `optionVar -query flareEndFlareZ`;
  702.     $cmd += " -curve " + `optionVar -query flareCurve`;
  703.  
  704.      // Build a positioning flag if needed
  705.     //
  706.     string $positioning = `optionVar -query flarePositioning`;
  707.     if ($positioning != "default") {
  708.         $cmd += (" -" + $positioning);
  709.     }
  710.     
  711.     int $exc=`optionVar -query flareExclusive`;
  712.     if ($exc) {
  713.         string $exn=`optionVar -query flareExclName`;
  714.         if ($exn!="") {
  715.             // make sure that we do not clash names with an existing
  716.             // partition when the user requested a new partition, even
  717.             // if the user may have entered a non-unique name
  718.             //
  719.             if ($exc == 1)     $exn += "#";
  720.             $cmd += (" -exclusive \"" + $exn+"\"");
  721.         }
  722.     }
  723.  
  724.     return $cmd;
  725. }
  726.  
  727.  
  728. //
  729. //  Procedure Name:
  730. //      performFlare
  731. //
  732. //  Description:
  733. //        Perform the flare command using the corresponding 
  734. //        option values.  This procedure will also show the option box
  735. //        window if necessary as well as construct the command string
  736. //        that will invoke the flare command with the current
  737. //        option box values.
  738. //
  739. //  Input Arguments:
  740. //      0 - Execute the command.
  741. //      1 - Show the option box dialog.
  742. //      2 - Return the command.
  743. //
  744. //  Return Value:
  745. //      None.
  746. //
  747. global proc string performFlare(int $action)
  748. {
  749.     string $cmd = "";
  750.  
  751.     switch ($action) {
  752.  
  753.         //    Execute the command.
  754.         //
  755.         case 0:
  756.             //    Retrieve the option settings
  757.             //
  758.             setOptionVars(false);
  759.  
  760.             //    Get the command.
  761.             //
  762.             $cmd = getCmd();
  763.  
  764.             //    Execute the command with the option settings.
  765.             //
  766.             evalEcho($cmd);
  767.  
  768.             break;
  769.  
  770.         //    Show the option box.
  771.         //
  772.         case 1:
  773.             flareOptions;
  774.             break;
  775.  
  776.         //    Return the command string.
  777.         //
  778.         case 2:
  779.             //    Retrieve the option settings.
  780.             //
  781.             setOptionVars (false);
  782.  
  783.             //    Get the command.
  784.             //
  785.             $cmd = getCmd();
  786.             break;
  787.     }
  788.     return $cmd;
  789. }
  790.  
  791.